package com.iot.gateway.utils.serializer;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * JSON序列化实现
 */
public class JsonSerializer<T> implements DataSerializer<T> {

    private final ObjectMapper objectMapper = new ObjectMapper();

    @Override
    public String serialize(T data) throws Exception {
        return objectMapper.writeValueAsString(data);
    }

}
